﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ArtOfNet.Framework.Data.Schema
{
    public class SchemaFactory
    {
        #region Members
        public DatabaseContext DataBase { get; set; }
        public List<BaseObject> Objects
        {
            get
            {
                return (
                    from o in DataBase.Objects
                    where !o.IsSystem
                    select o
                    ).ToList<BaseObject>();
                    
            }
        }

        public List<Table> Tables
        {
            get
            {
                return (
                    from t in DataBase.Tables
                    select t).ToList<Table>();
            }
        }

        #endregion

        #region Constructor
        public SchemaFactory(string cs)
        {
            DataBase = new DatabaseContext(cs);
        }
        public SchemaFactory()
        {
        }
        #endregion

        #region Methods
        public List<Table> GetTables()
        {
            return (
                from t in DataBase.Tables
                select t
                ).ToList<Table>();
        }

        #endregion

    }
}
